Repository navigation
feat(plugin-auth)!: SCIM projects the enterprise manager attribute into sys_user.manager_id - #34252
Conversation
…manager_id Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…gain Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…er error Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
📓 Docs Drift CheckThis PR changes 3 package(s): 59 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 17 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 30 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a2cf7ec8ee3226887a59068f84633dba317557c1 && git checkout a2cf7ec8ee3226887a59068f84633dba317557c1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f84dc192d728aa22e38770737583de3395f46b34 317c495572e4351db852b1e1e26183ac04a68f36 && git checkout -B drift-repro f84dc192d728aa22e38770737583de3395f46b34 && git merge --no-ff 317c495572e4351db852b1e1e26183ac04a68f36
node scripts/docs-audit/affected-docs.mjs --json f84dc192d728aa22e38770737583de3395f46b34
|
…e admin door and the SCIM projection Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head bec3326 · 2026-11-16T05:02Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T05:10Z. First review of this head; claim: comment 6907815215; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5 (zhuangjianguo); reviewed by os-tesla, who neither dispatched nor implemented it. Face: the committed changesets carry ① Derived judgmentsAgainst the card's four terms:
Findings:
No prior ids: this is the first review of the PR. ② Semver level
CI on this head: 66 check-runs, 53 success, 11 skipped, 2 failure ( ③ Boundary flags
④ Design judgmentThe seam is right: one screen, one write, inside the vendor's transaction, with the manager resolved inside the acting connection only. The design gap is ownership. The card closes "no path changes it" for identities the admin endpoint refuses, and the head projects onto a wider set and treats "the directory says nothing" as "the directory says none". Both follow from projecting the stored state without asking who owns the column, and both are settled by the one rule M2 asks for. Implemented-by: VERDICT: FAIL |
…ject only on directory-owned identities and on writes that name the attribute An unresolvable manager reference (unknown id, externalId-style value, another connection's id, unreadable $ref) no longer refuses the SCIM user write: the write lands, manager_id stays, and one bounded operator warn names the connection. The four structural refusals stay SCIM 400 invalidValue. A write that does not name the attribute leaves manager_id alone, and the projection writes only on identities the directory owns, read through the one predicate the admin endpoint's directory refusal reads. Lint explanation, docs and changesets follow the rule; both changesets declare the narrowing. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…ich the vendor always calls back on Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
|
domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv Hand-off · PR #34252 · Fixes #33918 · 2026-11-16T09:04Z By the maintainer's order to push and hand off, area S1 clocks out. The next seat takes this PR from here.
|
…e leaves one bounded scim_manager_unresolved row The served write's operator warn and the ledger row share one admission, so rows follow the warn's rate (one per connection per window) and carry its dropped count. The projection notes the event on the request scope; the SCIM arm hands it to the audit slot after the response, outside the vendor's transaction, only for an answer below 400. The row names the connection, the user's record and the reference capped at 256 characters, nothing else. Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
… scim_manager_unresolved audit row Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
…so the dispatcher error vocabulary reads them Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
…cale Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
…, the attribute the vendor lets past 256 characters Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
…s refusal, with no audit row Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
…ce, the write that names the manager Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw Final head · PR #34252 · Fixes #33918 · area o1-A · head 4c0b0ff · 2026-11-16T12:23Z Area o1-A took this PR over from
|
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head 4c0b0ff · 2026-11-16T12:25Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi 席位核对 · ACCEPT (L1, first read) · Head-sha: 4c0b0ff · 2026-11-16T12:29ZL1 thread L1-a for area o1-A, on the final head declared in 6916329740. No earlier L1 exists on this PR, so this read covers the full diff against merge base
The open item: a manager whose
|
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: Read at 2026-11-16. Delta review after record 6907927050 (head Earlier idsM1: closed.
① Derived judgmentsWhat is added, each judged right against the card and the two rulings:
What moves from accepted to refused:
Findings:
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing makes a declared refusal real; it takes no declared capability away. The docs on main say a directory-held user's manager is authored in the directory and that the admin operation's refusals guard the column; before this change the directory's answer went nowhere, so a refused link and an accepted one were indistinguishable (both served, neither written). On this head the accepted ones are written and the four structural ones are refused loudly, through one derivation shared with the admin door. Tried against it, as read:
The one place the design does not hold against ruling 6909383114 is M3: resolution is decided at the SCIM row, and the user's existence is left to a screen whose answer for "no such manager" is a refusal. Whether the vendor accepts PATCH shapes the names-the-attribute reader does not recognise was not measured here (vendor package absent); such a shape fails safe, writing nothing. Implemented-by: VERDICT: FAIL |
…ne, like any reference that names no User A connection's own SCIM User whose sys_user no longer exists screened as manager_not_found and answered SCIM 400. Per maintainer ruling 6909383114 it names no User: the write is served, manager_id is unchanged, and it gets the bounded warn and scim_manager_unresolved row. Only the four structural refusals answer 400. The ownership predicate now answers with the user's row, so the projection reads sys_user once per write instead of twice. Changesets: the upgrade note on replace-syncing providers that map no manager, and the note that the warn's admission runs inside the SCIM transaction. Lint and approvals docs say "no existing user". Claude-Session: https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw Final head · PR #34252 · Fixes #33918 · area o1-A · head 317c495 · 2026-11-16T14:19Z Head
|
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head 317c495 · 2026-11-16T14:21Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi 席位核对 · ACCEPT (L1, delta) · Head-sha: 317c495 · 2026-11-16T14:21ZThis is a delta read of the final head declared in 6919028644, against my ACCEPT 6916464429 at
Landing: not Tier H. After review#1's L2 delta PASS on this head and a green |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: Read at 2026-11-16. Delta review after record 6916550843 (head Earlier idsM3: closed.
① Derived judgmentsThis round, as read in the tree:
Everything judged right in record 6916550843 stands on this head; the round changes none of it. Findings: No must-fix, no should-fix.
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing still makes a declared refusal real and takes no declared capability away, and it now holds against maintainer ruling 6909383114 in full: resolution is decided in two steps (the SCIM row, then the platform user), and both steps end on the served path when they find no one; only self, cycle, depth and cross-organization refuse. Tried against it, as read:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5nNrLRm8ssuwWcBVcw Landing · PR #34252 · Fixes #33918 · head 317c495 · 2026-11-16T14:27Z
State change: ready and auto-merge armed. If the queue's dogfood gate goes red, area o1-A dequeues and treats it as this PR's own fault. #33918 closes on merge through |
Requested by Steedos · project thread
Fixes #33918
Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none —
skills/**teaches no SCIM route tosys_user.manager_id; the route is taught incontent/docs/automation/approvals.mdxandcontent/docs/capabilities/approvals.mdx, updated here.维护者速读
manager时,把它写进sys_user.manager_id;不点名不动,显式移除或不带它的替换才清空;只对目录持有的身份写,与管理员入口共用同一个归属判断;解析不到的上级(含该连接自己开过、但平台用户已被删除的上级)照常保存用户,并记一条运维告警和一条有界的审计记录。packages/plugins/plugin-auth/src/scim-manager-projection.ts(何时写、何时拒、何时只告警加留痕)、packages/plugins/plugin-audit/src/scim-refusal-audit.ts(新审计记录的内容与上限)、admin-set-user-manager.ts(共用的归属与拒绝判断)。pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/scim-manager-projection.test.ts,预期全部通过,其中「one bounded audit row per warn」一组验证留痕。What changes
BREAKING for a SCIM identity provider that sends a manager the admin endpoint would refuse. A SCIM create, replace or patch that names the Enterprise User
managerattribute, for an active user the directory holds, whose manager resolves to a User the same connection provisioned, and where the link would make the user their own manager, close a cycle, run past the depth cap, or cross an organization boundary, was served201/200withmanager_iduntouched. It is now refused with SCIM400invalidValueand nothing is written. Those four are the only requests served before and refused now.On upgrade. An identity provider that syncs by replace and maps no manager clears, on its next sync, a
manager_idset earlier for a user the directory holds, since a replace without the attribute is a clear. The plugin-auth changeset says so.scim-manager-projection.ts) runs on the vendor'sidentity.reconcileUsercallback, after the lifecycle reconcile (the ADR-0135 D4 stamp, untouched), and writes through the data engine inside the SCIM transaction.manager.valueis the manager's SCIM resourceidamong the Users the same connection provisioned (RFC 7643 section 4.3); a$refalone is read by its final/Users/{id}segment.scimUserManagerIntentOf, recorded on the SCIM request scope). A create or PATCH that does not name it leavesmanager_idalone; an explicit remove, or a replace without it, clears.directoryOwnsManagerOfinadmin-set-user-manager.tsis what the admin endpoint's directory refusal reads and what gates the projection, throughdirectoryOwnedUser, which answers with the user's row so the projection readssys_useronce per write and takes the currentmanager_idfrom it. On an identity the directory does not hold, the projection writes nothing.externalId-style value, another connection's id, a$refwith no readable segment (including one that does not decode), or this connection's own User whosesys_userno longer exists (the screen'smanager_not_found, routed to the served path rather than to a refusal) saves the user, leavesmanager_id, and is recorded with one operator warn and onescim_manager_unresolvedaudit row, both once per connection per window with the count held back. The check runs after the unchanged-manager short-circuit, and a write that does not name the attribute never reaches it.handleRequesthands it to theauditslot's newrecordScimManagerUnresolvedafter the response, outside the vendor's transaction, and only for an answer below 400. plugin-audit writes it through the SCIM writer's existing insert (scim-refusal-audit.ts):actorsvc:scim:CONNECTION_ID,object_namesys_user/record_idthe user,tenant_idthe connection's organization, andmetadatascim_connection_id,reference_kind,manager_reference(at most 256 characters,manager_reference_truncatedwhen cut) andsuppressed.sys_audit_log.actiongainsscim_manager_unresolved, labelled and translated in every shipped locale. Nopackages/specvalue and no error-code ledger row is added; plugin-auth's published exports are unchanged (the slot member is declared package-internally).screenUserManagerLink), imported, never copied: each a SCIM400invalidValuewith the refusal's sentence and its ADR-0112code, stamped as a literal per code (switched on the refusal's own code) socheck:dispatcher-error-vocabularyreads it; a code with no SCIM mapping fails loudly instead of being answered under another.MANAGER_ONLY_ROUTESsay the projection runs only for an active, directory-held user, from its profile-source connection, on a write that names the attribute, and that an id naming no existing user the connection provisioned is served.automation/approvals.mdxandcapabilities/approvals.mdxname SCIM as a route this platform gives, with the same rule; the first also names the audit row.Tests
packages/plugins/plugin-auth/src/scim-manager-projection.test.ts, end to end throughAuthManager.handleRequest()with a real SCIM bearer on ObjectQL over better-sqlite3:$ref; PUT change and PUT clear; PATCH set and PATCH remove; an unchanged manager not judged again (on a PATCH elsewhere and on a replace re-sending it once the chain above has grown past the cap); a deprovision with a dangling reference served.externalId, another connection's id,$refwithout a segment and one that does not decode, PATCH to an unknown id keeping the old manager; the warn names the connection and is bounded per window; a report whose manager was deleted keeps working on a PATCH that does not name it and on a PUT re-sending the dangling reference; a manager whosescimUserrow stays while itssys_userwas removed at the driver (past the engine's restrict) is served on a create and on a replace, the column unchanged (null on the create, the earlier live manager on the replace), with one warn and one event each (the replace in the next window).idp_provisioned) and the projection writes.status,scimType,codeand unchanged state.auditslot the door hands it to: one event per served unresolvable write, naming the connection, its organization, the user and the reference and nothing else; an unreadable$refrecorded as such; the reference capped at 257 characters at the door (reached through a long unreadable$ref: the vendor capsmanager.valueat 256 characters and a$refat 2048), with nothing of the body beside it; amanager.valuepast 256 characters is the vendor's own400 invalidValue, with nothing written, no warn and no row; rows follow the warn's rate (three unresolvable creates in a window: one event and one warn; past the window the next carriessuppressed: 2); no event on the served-unchanged paths (a resolved manager re-sent, a write that names none, a dangling reference left alone) and none on the structural refusals; a request refused after the warn admitted its reference records nothing, with a served control leg.scimBodyNamesManagerandreadScimManagerReferenceunit pins.packages/plugins/plugin-audit/src/scim-refusal-audit.test.ts(the writer's existing harness, a new top-level describe plus one case on the real slot): the row read back fromsys_audit_logonObjectQLPlugin+AuditPluginover sqlite (action, actor,object_name/record_id, tenant, exactmetadata); the reference cut to 256 characters withmanager_reference_truncated; undeclared fields never reach the row; an event that cannot name its connection, user or reference writes nothing; a refused insert is reported aterroronce per cause, apart from the refusal rows, and never thrown.sys-audit-log-action-labels.test.tsandsys-audit-log-retired-actions.test.tscarry the new action and its writer.packages/lint/src/validate-approval-approvers.test.ts: the pin on the rewritten sentence follows the new text.Acceptance notes
sys_audit_log.actionoption, which lives in plugin-audit's object, not inpackages/spec, and no error-code ledger row. It reuses the SCIM writer's named insert, so the tenant-audit census and the durability-log-level vocabulary are unchanged. The bound is the warn's own: one row per connection per 10-minute window, 1000 rows per window across connections, with the dropped count carried assuppressed.suppressed. The plugin-audit changeset says so.check:dispatcher-error-vocabulary(a helper passedrefusal.codethrough, so the gate could not read the codes); each code is now a literal at its stamp, no ledger row and no waiver.validate-approval-approvers.test.tsand the two docs pages are outside the claim's file surface, edited because the sentences they carried are made false by this change (docs per the S1 patch the seat supplied).Verification
Final head
317c4955, worktree on the dogfood closure plus lint (pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' --filter @objectstack/lint build, lockVERDICT command-exit 0), built after the last source change.Tests
scim-manager-projection.test.tsat317c4955: 36/36 (one new: a manager whosescimUserrow stays and whosesys_userwas removed at the driver, served on a create and on a replace).317c4955: 280 files, 5682 passed, 10 skipped.317c4955: 212 files, 9067/9067.c659399a(this round touches only its changeset), 97 files, 1577/1577 there.typecheckplugin-auth and lint at317c4955: exit 0.Ablations (each through scripts/ablation-replace.mjs, anchor hit once, restored to the HEAD blob with git diff HEAD empty)
Rerun at
317c4955for every leg whose code moved this round (A3, A4, A5, A7) and the new A13; the rest are from4c0b0ffd, on code this round does not touch.reconcileUser: 24 red.dcf1984e: the pin's PATCH names no manager and stops at the intent gate. The pin gained a replace that names the same manager (4c0b0ffd), and the rerun is red.4c0b0ffd: the replacement kept the anchor and the tool refused it as a no-op; rerun with a replacement that drops it.manager_not_foundbranch removed, so a manager whose user is gone goes to the refusal: 1 red, the new pin, onexpected 400 to be 201withINVALID_REFERENCE"The proposed manager does not exist".Gates
dispatch-gates --commandsat317c4955: 104 derived;--ranwith each exit code recorded: 101 run (all exit 0), 2 NOT MEASURED, 1 UNRUN.check:skill-examples(spec), CIType Check · consumer gateson317c4955: success;check:dual-build-cjs-loads, CIBuild Coreon317c4955: success.check:type-check-debt, whose closure build takes the shared verify lock behind siblings' locked batches; CIType Check · debt ledgeron317c4955: success.check:dispatcher-error-vocabulary: exit 0.check:i18n,check:i18n-stale-fill(derived) andcheck:i18n-coverage: exit 0.check-closing-keyword-parity --bodyexit 2, its report code: two of three parsers bind exactlyFixes #33918, nothing else;check-partof-closing-keywordexit 0;check-changeset-no-major --eventexit 0;check-closing-target-claimexit 0, with SCIM: project the enterprisemanagerattribute into sys_user.manager_id, so SCIM-held users' managers can change at all #33918 UNDETERMINED because the newestClaim:comment has noBranch:line the parser reads.Dogfood battery (the narrowing arm)
pnpm --filter @objectstack/dogfood testunder the verify lock on317c4955(no shard, no path): exit 0, lockVERDICT command-exit 0; Test Files 473 passed, 3 skipped (476); Tests 4003 passed, 42 skipped (4045); no failure.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5nNrLRm8ssuwWcBVcw